// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.


// Generated from TemplatingParser.g4 by ANTLR 4.7.2

// Unreachable code detected
#pragma warning disable 0162
// The variable '...' is assigned but its value is never used
#pragma warning disable 0219
// Missing XML comment for publicly visible type or member '...'
#pragma warning disable 1591
// Ambiguous reference in cref attribute
#pragma warning disable 419

namespace Templating.Grammar.Antlr
{
    using System;
    using System.IO;
    using Antlr4.Runtime;
    using Antlr4.Runtime.Atn;
    using Antlr4.Runtime.Misc;
    using Antlr4.Runtime.Tree;
    using DFA = Antlr4.Runtime.Dfa.DFA;

    [System.CodeDom.Compiler.GeneratedCode("ANTLR", "4.7.2")]
    [System.CLSCompliant(false)]
#pragma warning disable CS3021 // Type or member does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
    public partial class TemplatingParser : Parser
    {
#pragma warning restore CS3021 // Type or member does not need a CLSCompliant attribute because the assembly does not have a CLSCompliant attribute
        protected static DFA[] decisionToDFA;
        protected static PredictionContextCache sharedContextCache = new PredictionContextCache();
        public const int
            TOKEN_OP_RBRACE = 1, TOKEN_OP_LBRACKET = 2, TOKEN_MARK = 3, TOKEN_MARK_FOREACH = 4,
            TOKEN_EXPR = 5, TOKEN_PARTIAL = 6, TOKEN_EXPR_NEST = 7, TOKEN_OTHER = 8, TOKEN_OP_LBRACE = 9,
            TOKEN_OP_LPARENT = 10, TOKEN_OP_RPARENT = 11, TOKEN_OP_EQUAL = 12, TOKEN_OP_COMMA = 13,
            TOKEN_BLANK = 14, TOKEN_CONST_STRING = 15, TOKEN_CONST_INTEGER = 16, TOKEN_GROUPBY = 17,
            TOKEN_ORDERBY = 18, TOKEN_INTO = 19, TOKEN_IDENTIFIER = 20;
        public const int
            RULE_portal = 0, RULE_part = 1, RULE_foreachExpr = 2, RULE_foreachQueryExpr = 3,
            RULE_foreachIntoExpr = 4, RULE_groupByExpr = 5, RULE_orderByExpr = 6,
            RULE_objExpr = 7, RULE_bodyExpr = 8;
        public static readonly string[] ruleNames = {
        "portal", "part", "foreachExpr", "foreachQueryExpr", "foreachIntoExpr",
        "groupByExpr", "orderByExpr", "objExpr", "bodyExpr"
    };

        private static readonly string[] _LiteralNames = {
        null, "'}'", null, null, null, null, null, null, null, null, "'('", "')'",
        "'='", "','"
    };
        private static readonly string[] _SymbolicNames = {
        null, "TOKEN_OP_RBRACE", "TOKEN_OP_LBRACKET", "TOKEN_MARK", "TOKEN_MARK_FOREACH",
        "TOKEN_EXPR", "TOKEN_PARTIAL", "TOKEN_EXPR_NEST", "TOKEN_OTHER", "TOKEN_OP_LBRACE",
        "TOKEN_OP_LPARENT", "TOKEN_OP_RPARENT", "TOKEN_OP_EQUAL", "TOKEN_OP_COMMA",
        "TOKEN_BLANK", "TOKEN_CONST_STRING", "TOKEN_CONST_INTEGER", "TOKEN_GROUPBY",
        "TOKEN_ORDERBY", "TOKEN_INTO", "TOKEN_IDENTIFIER"
    };
        public static readonly IVocabulary DefaultVocabulary = new Vocabulary(_LiteralNames, _SymbolicNames);

        [NotNull]
        public override IVocabulary Vocabulary
        {
            get
            {
                return DefaultVocabulary;
            }
        }

        public override string GrammarFileName { get { return "TemplatingParser.g4"; } }

        public override string[] RuleNames { get { return ruleNames; } }

        public override string SerializedAtn { get { return new string(_serializedATN); } }

        static TemplatingParser()
        {
            decisionToDFA = new DFA[_ATN.NumberOfDecisions];
            for (int i = 0; i < _ATN.NumberOfDecisions; i++)
            {
                decisionToDFA[i] = new DFA(_ATN.GetDecisionState(i), i);
            }
        }

        public TemplatingParser(ITokenStream input) : this(input, Console.Out, Console.Error) { }

        public TemplatingParser(ITokenStream input, TextWriter output, TextWriter errorOutput)
        : base(input, output, errorOutput)
        {
            Interpreter = new ParserATNSimulator(this, _ATN, decisionToDFA, sharedContextCache);
        }

        public partial class PortalContext : ParserRuleContext
        {
            public PartContext[] part()
            {
                return GetRuleContexts<PartContext>();
            }
            public PartContext part(int i)
            {
                return GetRuleContext<PartContext>(i);
            }
            public PortalContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_portal; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitPortal(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public PortalContext portal()
        {
            PortalContext _localctx = new PortalContext(Context, State);
            EnterRule(_localctx, 0, RULE_portal);
            int _la;
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 19;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    do
                    {
                        {
                            {
                                State = 18; part();
                            }
                        }
                        State = 21;
                        ErrorHandler.Sync(this);
                        _la = TokenStream.LA(1);
                    } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << TOKEN_OP_LBRACKET) | (1L << TOKEN_MARK_FOREACH) | (1L << TOKEN_EXPR) | (1L << TOKEN_PARTIAL) | (1L << TOKEN_OTHER))) != 0));
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class PartContext : ParserRuleContext
        {
            public PartContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_part; } }

            public PartContext() { }
            public virtual void CopyFrom(PartContext context)
            {
                base.CopyFrom(context);
            }
        }
        public partial class ForeachContext : PartContext
        {
            public ForeachExprContext foreachExpr()
            {
                return GetRuleContext<ForeachExprContext>(0);
            }
            public ForeachContext(PartContext context) { CopyFrom(context); }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitForeach(this);
                else return visitor.VisitChildren(this);
            }
        }
        public partial class OtherContext : PartContext
        {
            public ITerminalNode TOKEN_OTHER() { return GetToken(TemplatingParser.TOKEN_OTHER, 0); }
            public OtherContext(PartContext context) { CopyFrom(context); }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitOther(this);
                else return visitor.VisitChildren(this);
            }
        }
        public partial class ParentPartContext : PartContext
        {
            public ITerminalNode TOKEN_OP_LBRACKET() { return GetToken(TemplatingParser.TOKEN_OP_LBRACKET, 0); }
            public ITerminalNode TOKEN_OP_RBRACE() { return GetToken(TemplatingParser.TOKEN_OP_RBRACE, 0); }
            public PartContext[] part()
            {
                return GetRuleContexts<PartContext>();
            }
            public PartContext part(int i)
            {
                return GetRuleContext<PartContext>(i);
            }
            public ParentPartContext(PartContext context) { CopyFrom(context); }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitParentPart(this);
                else return visitor.VisitChildren(this);
            }
        }
        public partial class ExprContext : PartContext
        {
            public ITerminalNode TOKEN_EXPR() { return GetToken(TemplatingParser.TOKEN_EXPR, 0); }
            public ExprContext(PartContext context) { CopyFrom(context); }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitExpr(this);
                else return visitor.VisitChildren(this);
            }
        }
        public partial class PartialContext : PartContext
        {
            public ITerminalNode TOKEN_PARTIAL() { return GetToken(TemplatingParser.TOKEN_PARTIAL, 0); }
            public PartialContext(PartContext context) { CopyFrom(context); }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitPartial(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public PartContext part()
        {
            PartContext _localctx = new PartContext(Context, State);
            EnterRule(_localctx, 2, RULE_part);
            int _la;
            try
            {
                State = 35;
                ErrorHandler.Sync(this);
                switch (TokenStream.LA(1))
                {
                    case TOKEN_EXPR:
                        _localctx = new ExprContext(_localctx);
                        EnterOuterAlt(_localctx, 1);
                        {
                            State = 23; Match(TOKEN_EXPR);
                        }
                        break;
                    case TOKEN_PARTIAL:
                        _localctx = new PartialContext(_localctx);
                        EnterOuterAlt(_localctx, 2);
                        {
                            State = 24; Match(TOKEN_PARTIAL);
                        }
                        break;
                    case TOKEN_OTHER:
                        _localctx = new OtherContext(_localctx);
                        EnterOuterAlt(_localctx, 3);
                        {
                            State = 25; Match(TOKEN_OTHER);
                        }
                        break;
                    case TOKEN_MARK_FOREACH:
                        _localctx = new ForeachContext(_localctx);
                        EnterOuterAlt(_localctx, 4);
                        {
                            State = 26; foreachExpr();
                        }
                        break;
                    case TOKEN_OP_LBRACKET:
                        _localctx = new ParentPartContext(_localctx);
                        EnterOuterAlt(_localctx, 5);
                        {
                            State = 27; Match(TOKEN_OP_LBRACKET);
                            State = 29;
                            ErrorHandler.Sync(this);
                            _la = TokenStream.LA(1);
                            do
                            {
                                {
                                    {
                                        State = 28; part();
                                    }
                                }
                                State = 31;
                                ErrorHandler.Sync(this);
                                _la = TokenStream.LA(1);
                            } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << TOKEN_OP_LBRACKET) | (1L << TOKEN_MARK_FOREACH) | (1L << TOKEN_EXPR) | (1L << TOKEN_PARTIAL) | (1L << TOKEN_OTHER))) != 0));
                            State = 33; Match(TOKEN_OP_RBRACE);
                        }
                        break;
                    default:
                        throw new NoViableAltException(this);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class ForeachExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_MARK_FOREACH() { return GetToken(TemplatingParser.TOKEN_MARK_FOREACH, 0); }
            public ITerminalNode TOKEN_OP_LBRACE() { return GetToken(TemplatingParser.TOKEN_OP_LBRACE, 0); }
            public BodyExprContext bodyExpr()
            {
                return GetRuleContext<BodyExprContext>(0);
            }
            public ITerminalNode TOKEN_OP_RBRACE() { return GetToken(TemplatingParser.TOKEN_OP_RBRACE, 0); }
            public ForeachQueryExprContext foreachQueryExpr()
            {
                return GetRuleContext<ForeachQueryExprContext>(0);
            }
            public ForeachExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_foreachExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitForeachExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public ForeachExprContext foreachExpr()
        {
            ForeachExprContext _localctx = new ForeachExprContext(Context, State);
            EnterRule(_localctx, 4, RULE_foreachExpr);
            int _la;
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 37; Match(TOKEN_MARK_FOREACH);
                    State = 39;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_OP_LPARENT)
                    {
                        {
                            State = 38; foreachQueryExpr();
                        }
                    }

                    State = 41; Match(TOKEN_OP_LBRACE);
                    State = 42; bodyExpr();
                    State = 43; Match(TOKEN_OP_RBRACE);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class ForeachQueryExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_OP_LPARENT() { return GetToken(TemplatingParser.TOKEN_OP_LPARENT, 0); }
            public ITerminalNode TOKEN_OP_RPARENT() { return GetToken(TemplatingParser.TOKEN_OP_RPARENT, 0); }
            public ITerminalNode TOKEN_IDENTIFIER() { return GetToken(TemplatingParser.TOKEN_IDENTIFIER, 0); }
            public OrderByExprContext orderByExpr()
            {
                return GetRuleContext<OrderByExprContext>(0);
            }
            public GroupByExprContext groupByExpr()
            {
                return GetRuleContext<GroupByExprContext>(0);
            }
            public ForeachIntoExprContext foreachIntoExpr()
            {
                return GetRuleContext<ForeachIntoExprContext>(0);
            }
            public ForeachQueryExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_foreachQueryExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitForeachQueryExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public ForeachQueryExprContext foreachQueryExpr()
        {
            ForeachQueryExprContext _localctx = new ForeachQueryExprContext(Context, State);
            EnterRule(_localctx, 6, RULE_foreachQueryExpr);
            int _la;
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 45; Match(TOKEN_OP_LPARENT);
                    State = 47;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_IDENTIFIER)
                    {
                        {
                            State = 46; Match(TOKEN_IDENTIFIER);
                        }
                    }

                    State = 50;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_ORDERBY)
                    {
                        {
                            State = 49; orderByExpr();
                        }
                    }

                    State = 53;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_GROUPBY)
                    {
                        {
                            State = 52; groupByExpr();
                        }
                    }

                    State = 56;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_INTO)
                    {
                        {
                            State = 55; foreachIntoExpr();
                        }
                    }

                    State = 58; Match(TOKEN_OP_RPARENT);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class ForeachIntoExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_INTO() { return GetToken(TemplatingParser.TOKEN_INTO, 0); }
            public ITerminalNode TOKEN_IDENTIFIER() { return GetToken(TemplatingParser.TOKEN_IDENTIFIER, 0); }
            public ForeachIntoExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_foreachIntoExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitForeachIntoExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public ForeachIntoExprContext foreachIntoExpr()
        {
            ForeachIntoExprContext _localctx = new ForeachIntoExprContext(Context, State);
            EnterRule(_localctx, 8, RULE_foreachIntoExpr);
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 60; Match(TOKEN_INTO);
                    State = 61; Match(TOKEN_IDENTIFIER);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class GroupByExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_GROUPBY() { return GetToken(TemplatingParser.TOKEN_GROUPBY, 0); }
            public ITerminalNode TOKEN_OP_LPARENT() { return GetToken(TemplatingParser.TOKEN_OP_LPARENT, 0); }
            public ITerminalNode TOKEN_CONST_STRING() { return GetToken(TemplatingParser.TOKEN_CONST_STRING, 0); }
            public ITerminalNode TOKEN_OP_RPARENT() { return GetToken(TemplatingParser.TOKEN_OP_RPARENT, 0); }
            public OrderByExprContext orderByExpr()
            {
                return GetRuleContext<OrderByExprContext>(0);
            }
            public GroupByExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_groupByExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitGroupByExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public GroupByExprContext groupByExpr()
        {
            GroupByExprContext _localctx = new GroupByExprContext(Context, State);
            EnterRule(_localctx, 10, RULE_groupByExpr);
            int _la;
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 63; Match(TOKEN_GROUPBY);
                    State = 64; Match(TOKEN_OP_LPARENT);
                    State = 65; Match(TOKEN_CONST_STRING);
                    State = 67;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if (_la == TOKEN_ORDERBY)
                    {
                        {
                            State = 66; orderByExpr();
                        }
                    }

                    State = 69; Match(TOKEN_OP_RPARENT);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class OrderByExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_ORDERBY() { return GetToken(TemplatingParser.TOKEN_ORDERBY, 0); }
            public ITerminalNode TOKEN_OP_LPARENT() { return GetToken(TemplatingParser.TOKEN_OP_LPARENT, 0); }
            public ITerminalNode TOKEN_CONST_STRING() { return GetToken(TemplatingParser.TOKEN_CONST_STRING, 0); }
            public ITerminalNode TOKEN_OP_RPARENT() { return GetToken(TemplatingParser.TOKEN_OP_RPARENT, 0); }
            public OrderByExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_orderByExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitOrderByExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public OrderByExprContext orderByExpr()
        {
            OrderByExprContext _localctx = new OrderByExprContext(Context, State);
            EnterRule(_localctx, 12, RULE_orderByExpr);
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 71; Match(TOKEN_ORDERBY);
                    State = 72; Match(TOKEN_OP_LPARENT);
                    State = 73; Match(TOKEN_CONST_STRING);
                    State = 74; Match(TOKEN_OP_RPARENT);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class ObjExprContext : ParserRuleContext
        {
            public ITerminalNode TOKEN_OP_LBRACKET() { return GetToken(TemplatingParser.TOKEN_OP_LBRACKET, 0); }
            public BodyExprContext bodyExpr()
            {
                return GetRuleContext<BodyExprContext>(0);
            }
            public ITerminalNode TOKEN_OP_RBRACE() { return GetToken(TemplatingParser.TOKEN_OP_RBRACE, 0); }
            public ObjExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_objExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitObjExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public ObjExprContext objExpr()
        {
            ObjExprContext _localctx = new ObjExprContext(Context, State);
            EnterRule(_localctx, 14, RULE_objExpr);
            try
            {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 76; Match(TOKEN_OP_LBRACKET);
                    State = 77; bodyExpr();
                    State = 78; Match(TOKEN_OP_RBRACE);
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        public partial class BodyExprContext : ParserRuleContext
        {
            public PartContext[] part()
            {
                return GetRuleContexts<PartContext>();
            }
            public PartContext part(int i)
            {
                return GetRuleContext<PartContext>(i);
            }
            public ObjExprContext objExpr()
            {
                return GetRuleContext<ObjExprContext>(0);
            }
            public BodyExprContext(ParserRuleContext parent, int invokingState)
                : base(parent, invokingState)
            {
            }
            public override int RuleIndex { get { return RULE_bodyExpr; } }
            public override TResult Accept<TResult>(IParseTreeVisitor<TResult> visitor)
            {
                ITemplatingParserVisitor<TResult> typedVisitor = visitor as ITemplatingParserVisitor<TResult>;
                if (typedVisitor != null) return typedVisitor.VisitBodyExpr(this);
                else return visitor.VisitChildren(this);
            }
        }

        [RuleVersion(0)]
        public BodyExprContext bodyExpr()
        {
            BodyExprContext _localctx = new BodyExprContext(Context, State);
            EnterRule(_localctx, 16, RULE_bodyExpr);
            int _la;
            try
            {
                int _alt;
                State = 100;
                ErrorHandler.Sync(this);
                switch (Interpreter.AdaptivePredict(TokenStream, 14, Context))
                {
                    case 1:
                        EnterOuterAlt(_localctx, 1);
                        {
                            State = 81;
                            ErrorHandler.Sync(this);
                            _la = TokenStream.LA(1);
                            do
                            {
                                {
                                    {
                                        State = 80; part();
                                    }
                                }
                                State = 83;
                                ErrorHandler.Sync(this);
                                _la = TokenStream.LA(1);
                            } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << TOKEN_OP_LBRACKET) | (1L << TOKEN_MARK_FOREACH) | (1L << TOKEN_EXPR) | (1L << TOKEN_PARTIAL) | (1L << TOKEN_OTHER))) != 0));
                        }
                        break;
                    case 2:
                        EnterOuterAlt(_localctx, 2);
                        {
                            State = 90;
                            ErrorHandler.Sync(this);
                            switch (Interpreter.AdaptivePredict(TokenStream, 11, Context))
                            {
                                case 1:
                                {
                                    State = 86;
                                    ErrorHandler.Sync(this);
                                    _alt = 1;
                                    do
                                    {
                                        switch (_alt)
                                        {
                                            case 1:
                                            {
                                                {
                                                    State = 85; part();
                                                }
                                            }
                                            break;
                                            default:
                                                throw new NoViableAltException(this);
                                        }
                                        State = 88;
                                        ErrorHandler.Sync(this);
                                        _alt = Interpreter.AdaptivePredict(TokenStream, 10, Context);
                                    } while (_alt != 2 && _alt != global::Antlr4.Runtime.Atn.ATN.INVALID_ALT_NUMBER);
                                }
                                break;
                            }
                            State = 92; objExpr();
                            State = 98;
                            ErrorHandler.Sync(this);
                            _la = TokenStream.LA(1);
                            if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << TOKEN_OP_LBRACKET) | (1L << TOKEN_MARK_FOREACH) | (1L << TOKEN_EXPR) | (1L << TOKEN_PARTIAL) | (1L << TOKEN_OTHER))) != 0))
                            {
                                {
                                    State = 94;
                                    ErrorHandler.Sync(this);
                                    _la = TokenStream.LA(1);
                                    do
                                    {
                                        {
                                            {
                                                State = 93; part();
                                            }
                                        }
                                        State = 96;
                                        ErrorHandler.Sync(this);
                                        _la = TokenStream.LA(1);
                                    } while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << TOKEN_OP_LBRACKET) | (1L << TOKEN_MARK_FOREACH) | (1L << TOKEN_EXPR) | (1L << TOKEN_PARTIAL) | (1L << TOKEN_OTHER))) != 0));
                                }
                            }

                        }
                        break;
                }
            }
            catch (RecognitionException re)
            {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally
            {
                ExitRule();
            }
            return _localctx;
        }

        private static char[] _serializedATN = {
        '\x3', '\x608B', '\xA72A', '\x8133', '\xB9ED', '\x417C', '\x3BE7', '\x7786',
        '\x5964', '\x3', '\x16', 'i', '\x4', '\x2', '\t', '\x2', '\x4', '\x3',
        '\t', '\x3', '\x4', '\x4', '\t', '\x4', '\x4', '\x5', '\t', '\x5', '\x4',
        '\x6', '\t', '\x6', '\x4', '\a', '\t', '\a', '\x4', '\b', '\t', '\b',
        '\x4', '\t', '\t', '\t', '\x4', '\n', '\t', '\n', '\x3', '\x2', '\x6',
        '\x2', '\x16', '\n', '\x2', '\r', '\x2', '\xE', '\x2', '\x17', '\x3',
        '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3', '\x3',
        '\x3', '\x6', '\x3', ' ', '\n', '\x3', '\r', '\x3', '\xE', '\x3', '!',
        '\x3', '\x3', '\x3', '\x3', '\x5', '\x3', '&', '\n', '\x3', '\x3', '\x4',
        '\x3', '\x4', '\x5', '\x4', '*', '\n', '\x4', '\x3', '\x4', '\x3', '\x4',
        '\x3', '\x4', '\x3', '\x4', '\x3', '\x5', '\x3', '\x5', '\x5', '\x5',
        '\x32', '\n', '\x5', '\x3', '\x5', '\x5', '\x5', '\x35', '\n', '\x5',
        '\x3', '\x5', '\x5', '\x5', '\x38', '\n', '\x5', '\x3', '\x5', '\x5',
        '\x5', ';', '\n', '\x5', '\x3', '\x5', '\x3', '\x5', '\x3', '\x6', '\x3',
        '\x6', '\x3', '\x6', '\x3', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\a',
        '\x5', '\a', '\x46', '\n', '\a', '\x3', '\a', '\x3', '\a', '\x3', '\b',
        '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\b', '\x3', '\t', '\x3',
        '\t', '\x3', '\t', '\x3', '\t', '\x3', '\n', '\x6', '\n', 'T', '\n', '\n',
        '\r', '\n', '\xE', '\n', 'U', '\x3', '\n', '\x6', '\n', 'Y', '\n', '\n',
        '\r', '\n', '\xE', '\n', 'Z', '\x5', '\n', ']', '\n', '\n', '\x3', '\n',
        '\x3', '\n', '\x6', '\n', '\x61', '\n', '\n', '\r', '\n', '\xE', '\n',
        '\x62', '\x5', '\n', '\x65', '\n', '\n', '\x5', '\n', 'g', '\n', '\n',
        '\x3', '\n', '\x2', '\x2', '\v', '\x2', '\x4', '\x6', '\b', '\n', '\f',
        '\xE', '\x10', '\x12', '\x2', '\x2', '\x2', 'q', '\x2', '\x15', '\x3',
        '\x2', '\x2', '\x2', '\x4', '%', '\x3', '\x2', '\x2', '\x2', '\x6', '\'',
        '\x3', '\x2', '\x2', '\x2', '\b', '/', '\x3', '\x2', '\x2', '\x2', '\n',
        '>', '\x3', '\x2', '\x2', '\x2', '\f', '\x41', '\x3', '\x2', '\x2', '\x2',
        '\xE', 'I', '\x3', '\x2', '\x2', '\x2', '\x10', 'N', '\x3', '\x2', '\x2',
        '\x2', '\x12', '\x66', '\x3', '\x2', '\x2', '\x2', '\x14', '\x16', '\x5',
        '\x4', '\x3', '\x2', '\x15', '\x14', '\x3', '\x2', '\x2', '\x2', '\x16',
        '\x17', '\x3', '\x2', '\x2', '\x2', '\x17', '\x15', '\x3', '\x2', '\x2',
        '\x2', '\x17', '\x18', '\x3', '\x2', '\x2', '\x2', '\x18', '\x3', '\x3',
        '\x2', '\x2', '\x2', '\x19', '&', '\a', '\a', '\x2', '\x2', '\x1A', '&',
        '\a', '\b', '\x2', '\x2', '\x1B', '&', '\a', '\n', '\x2', '\x2', '\x1C',
        '&', '\x5', '\x6', '\x4', '\x2', '\x1D', '\x1F', '\a', '\x4', '\x2', '\x2',
        '\x1E', ' ', '\x5', '\x4', '\x3', '\x2', '\x1F', '\x1E', '\x3', '\x2',
        '\x2', '\x2', ' ', '!', '\x3', '\x2', '\x2', '\x2', '!', '\x1F', '\x3',
        '\x2', '\x2', '\x2', '!', '\"', '\x3', '\x2', '\x2', '\x2', '\"', '#',
        '\x3', '\x2', '\x2', '\x2', '#', '$', '\a', '\x3', '\x2', '\x2', '$',
        '&', '\x3', '\x2', '\x2', '\x2', '%', '\x19', '\x3', '\x2', '\x2', '\x2',
        '%', '\x1A', '\x3', '\x2', '\x2', '\x2', '%', '\x1B', '\x3', '\x2', '\x2',
        '\x2', '%', '\x1C', '\x3', '\x2', '\x2', '\x2', '%', '\x1D', '\x3', '\x2',
        '\x2', '\x2', '&', '\x5', '\x3', '\x2', '\x2', '\x2', '\'', ')', '\a',
        '\x6', '\x2', '\x2', '(', '*', '\x5', '\b', '\x5', '\x2', ')', '(', '\x3',
        '\x2', '\x2', '\x2', ')', '*', '\x3', '\x2', '\x2', '\x2', '*', '+', '\x3',
        '\x2', '\x2', '\x2', '+', ',', '\a', '\v', '\x2', '\x2', ',', '-', '\x5',
        '\x12', '\n', '\x2', '-', '.', '\a', '\x3', '\x2', '\x2', '.', '\a', '\x3',
        '\x2', '\x2', '\x2', '/', '\x31', '\a', '\f', '\x2', '\x2', '\x30', '\x32',
        '\a', '\x16', '\x2', '\x2', '\x31', '\x30', '\x3', '\x2', '\x2', '\x2',
        '\x31', '\x32', '\x3', '\x2', '\x2', '\x2', '\x32', '\x34', '\x3', '\x2',
        '\x2', '\x2', '\x33', '\x35', '\x5', '\xE', '\b', '\x2', '\x34', '\x33',
        '\x3', '\x2', '\x2', '\x2', '\x34', '\x35', '\x3', '\x2', '\x2', '\x2',
        '\x35', '\x37', '\x3', '\x2', '\x2', '\x2', '\x36', '\x38', '\x5', '\f',
        '\a', '\x2', '\x37', '\x36', '\x3', '\x2', '\x2', '\x2', '\x37', '\x38',
        '\x3', '\x2', '\x2', '\x2', '\x38', ':', '\x3', '\x2', '\x2', '\x2', '\x39',
        ';', '\x5', '\n', '\x6', '\x2', ':', '\x39', '\x3', '\x2', '\x2', '\x2',
        ':', ';', '\x3', '\x2', '\x2', '\x2', ';', '<', '\x3', '\x2', '\x2', '\x2',
        '<', '=', '\a', '\r', '\x2', '\x2', '=', '\t', '\x3', '\x2', '\x2', '\x2',
        '>', '?', '\a', '\x15', '\x2', '\x2', '?', '@', '\a', '\x16', '\x2', '\x2',
        '@', '\v', '\x3', '\x2', '\x2', '\x2', '\x41', '\x42', '\a', '\x13', '\x2',
        '\x2', '\x42', '\x43', '\a', '\f', '\x2', '\x2', '\x43', '\x45', '\a',
        '\x11', '\x2', '\x2', '\x44', '\x46', '\x5', '\xE', '\b', '\x2', '\x45',
        '\x44', '\x3', '\x2', '\x2', '\x2', '\x45', '\x46', '\x3', '\x2', '\x2',
        '\x2', '\x46', 'G', '\x3', '\x2', '\x2', '\x2', 'G', 'H', '\a', '\r',
        '\x2', '\x2', 'H', '\r', '\x3', '\x2', '\x2', '\x2', 'I', 'J', '\a', '\x14',
        '\x2', '\x2', 'J', 'K', '\a', '\f', '\x2', '\x2', 'K', 'L', '\a', '\x11',
        '\x2', '\x2', 'L', 'M', '\a', '\r', '\x2', '\x2', 'M', '\xF', '\x3', '\x2',
        '\x2', '\x2', 'N', 'O', '\a', '\x4', '\x2', '\x2', 'O', 'P', '\x5', '\x12',
        '\n', '\x2', 'P', 'Q', '\a', '\x3', '\x2', '\x2', 'Q', '\x11', '\x3',
        '\x2', '\x2', '\x2', 'R', 'T', '\x5', '\x4', '\x3', '\x2', 'S', 'R', '\x3',
        '\x2', '\x2', '\x2', 'T', 'U', '\x3', '\x2', '\x2', '\x2', 'U', 'S', '\x3',
        '\x2', '\x2', '\x2', 'U', 'V', '\x3', '\x2', '\x2', '\x2', 'V', 'g', '\x3',
        '\x2', '\x2', '\x2', 'W', 'Y', '\x5', '\x4', '\x3', '\x2', 'X', 'W', '\x3',
        '\x2', '\x2', '\x2', 'Y', 'Z', '\x3', '\x2', '\x2', '\x2', 'Z', 'X', '\x3',
        '\x2', '\x2', '\x2', 'Z', '[', '\x3', '\x2', '\x2', '\x2', '[', ']', '\x3',
        '\x2', '\x2', '\x2', '\\', 'X', '\x3', '\x2', '\x2', '\x2', '\\', ']',
        '\x3', '\x2', '\x2', '\x2', ']', '^', '\x3', '\x2', '\x2', '\x2', '^',
        '\x64', '\x5', '\x10', '\t', '\x2', '_', '\x61', '\x5', '\x4', '\x3',
        '\x2', '`', '_', '\x3', '\x2', '\x2', '\x2', '\x61', '\x62', '\x3', '\x2',
        '\x2', '\x2', '\x62', '`', '\x3', '\x2', '\x2', '\x2', '\x62', '\x63',
        '\x3', '\x2', '\x2', '\x2', '\x63', '\x65', '\x3', '\x2', '\x2', '\x2',
        '\x64', '`', '\x3', '\x2', '\x2', '\x2', '\x64', '\x65', '\x3', '\x2',
        '\x2', '\x2', '\x65', 'g', '\x3', '\x2', '\x2', '\x2', '\x66', 'S', '\x3',
        '\x2', '\x2', '\x2', '\x66', '\\', '\x3', '\x2', '\x2', '\x2', 'g', '\x13',
        '\x3', '\x2', '\x2', '\x2', '\x11', '\x17', '!', '%', ')', '\x31', '\x34',
        '\x37', ':', '\x45', 'U', 'Z', '\\', '\x62', '\x64', '\x66',
    };

        public static readonly ATN _ATN =
            new ATNDeserializer().Deserialize(_serializedATN);


    }
} // namespace Templating.Grammar.Antlr
